﻿using System;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using O1;
using O1.Data.Traversal;

namespace Tests.O1.Data.Traversal
{
    [TestClass]
    public class PrimeExtensionsTests
    {
        [TestMethod, TestCategory("Unit Test")]
        public void PrimeExtensionsRoundToPrimeReturns3WhenValueLessThan3()
        {
            (-1).RoundToPositivePrime().Should().Be(3);
            (0).RoundToPositivePrime().Should().Be(3);
            (1).RoundToPositivePrime().Should().Be(3);
            (2).RoundToPositivePrime().Should().Be(3);
        }

        [TestMethod, TestCategory("Unit Test")]
        public void PrimeExtensionsRoundToPrimeReturnsLargerValue()
        {
            (-1).RoundToPositivePrime(2).Should().BeGreaterThan(-2);
            (0).RoundToPositivePrime(2).Should().BeGreaterThan(0);
            (1).RoundToPositivePrime(2).Should().BeGreaterThan(2);
            (2).RoundToPositivePrime(2).Should().BeGreaterThan(4);
        }

        [TestMethod, TestCategory("Unit Test")]
        public void PrimeExtensionsRoundToPrimeReturnsMaxPrimeWhenLargerValueIsProvided()
        {
            int.MaxValue.RoundToPositivePrime().Should().Be(PrimeExtensions.MaxPrime);
        }
    }
}
